<?php
$conn = new pdo('mysql:host=localhost;port=3306;dbname=zgdb;charset=UTF8', 'root', '', []);
$pst = $conn->prepare('select id,name from t_user order by id desc');
$pst->execute();
//$result = $pst->fetchAll(PDO::FETCH_BOTH);
$result = $pst->fetchAll(PDO::FETCH_ASSOC); //关联数组
// $result = $pst->fetchAll(PDO::FETCH_NUM); //索引数组
//echo '<pre>';
//print_r($result);
foreach ($result as $rows) {
    // $b = array_pop($rows);
    // $a = array_pop($rows);
    //list($id, $name) = array_values($rows);
    //echo $id, $name, '<br>';
    echo $rows['id'], $rows['name'], '<br>';
}